package com.hundsun.yr.universal.p2p.bean;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;

import com.hundsun.mobile.zwgt.R;

/**
 * Created by xx on 2017/5/12.
 */
public class RepayPlanBeen {
    /**
     * amount : 54250.00
     * ctime : 1494412216
     * id : 762
     * product_uuid : 00028c
     * progress : 0
     * repay_capital : 50000.00
     * repay_date : 2018-05-05
     * repay_user_no : 20170420150030351116
     * utime : 1494412216
     */

    public String amount;
    public String ctime;
    public String id;
    public String product_uuid;
    public String progress;
    public String repay_capital;
    public String repay_date;
    public String repay_user_no;
    public String utime;
    /**
     * actual_amount : 452.09
     * actual_repay_time : 2017-05-13 17:14:33
     */

    public String actual_amount;
    public String actual_repay_time;
    /**
     * actual_repay_capital : 4025.38
     */

    public String actual_repay_capital;

    /**
     * 0	未回款
     * 1	已回款
     * 2	部分回款
     * 3	逾期未还款
     * 4	逾期已回款
     * 5	兑付中
     * 6	已兑付
     * 8	已提前还款
     * 9	提前还款兑付中
     * 10	提前还款并已兑付
     * 11	提前还款并已关闭
     * 100	违约
     * 110	代偿未还款
     *
     * @param mContext
     * @return
     */
    public String getProgress(Context mContext) {
        if (TextUtils.equals(progress, "0")) {
            return mContext.getString(R.string.payment_progress0);
        } else if (TextUtils.equals(progress, "1")) {
            return mContext.getString(R.string.payment_progress1);
        } else if (TextUtils.equals(progress, "2")) {
            return mContext.getString(R.string.payment_progress2);
        } else if (TextUtils.equals(progress, "3")) {
            return mContext.getString(R.string.payment_progress3);
        } else if (TextUtils.equals(progress, "4")) {
            return mContext.getString(R.string.payment_progress4);
        } else if (TextUtils.equals(progress, "5")) {
            return mContext.getString(R.string.payment_progress5);
        } else if (TextUtils.equals(progress, "6")) {
            return mContext.getString(R.string.payment_progress6);
        } else if (TextUtils.equals(progress, "8")) {
            return mContext.getString(R.string.payment_progress8);
        } else if (TextUtils.equals(progress, "9")) {
            return mContext.getString(R.string.payment_progress9);
        } else if (TextUtils.equals(progress, "10")) {
            return mContext.getString(R.string.payment_progress6);
        } else if (TextUtils.equals(progress, "11")) {
            return mContext.getString(R.string.payment_progress11);
        } else if (TextUtils.equals(progress, "100")) {
            return mContext.getString(R.string.payment_progress100);
        } else {
            return mContext.getString(R.string.payment_progress110);
        }
    }

    /**
     * 根据不同状态显示隐藏
     */
    public void dispalyStatus(final View line_below_1, final View line_below_2, final View line_below_3, final View line_above_2, final String idfirst, final String idLast) {
        if (TextUtils.equals(idfirst, id)) {
            line_below_1.setVisibility(View.INVISIBLE);
            line_above_2.setVisibility(View.INVISIBLE);
        } else if (TextUtils.equals(idLast, id)) {
            line_below_3.setVisibility(View.INVISIBLE);
            line_below_2.setVisibility(View.INVISIBLE);
        } else {
            line_below_1.setVisibility(View.VISIBLE);
            line_above_2.setVisibility(View.VISIBLE);
            line_below_3.setVisibility(View.VISIBLE);
            line_below_2.setVisibility(View.VISIBLE);
        }
    }

    @Override
    public String toString() {
        return "RepayPlanBeen{" +
                "amount='" + amount + '\'' +
                ", ctime='" + ctime + '\'' +
                ", id='" + id + '\'' +
                ", product_uuid='" + product_uuid + '\'' +
                ", progress='" + progress + '\'' +
                ", repay_capital='" + repay_capital + '\'' +
                ", repay_date='" + repay_date + '\'' +
                ", repay_user_no='" + repay_user_no + '\'' +
                ", utime='" + utime + '\'' +
                ", actual_amount='" + actual_amount + '\'' +
                ", actual_repay_time='" + actual_repay_time + '\'' +
                ", actual_repay_capital='" + actual_repay_capital + '\'' +
                '}';
    }
}
